import Vue from 'vue'
import VueRouter from 'vue-router'


// import Home from '../views/Home/Home'
// import Order from '../views/Order/Order'
// import Person from '../views/Person/Person'
// import Search from '../views/Search/Search'
const Home = ()=> import('../views/Home/Home')
const Order = ()=> import('../views/Order/Order')
const Person = ()=> import('../views/Person/Person')
const Search = ()=> import('../views/Search/Search')

const Login = ()=> import('../views/Login/Login')
const Shop = ()=> import('../views/Shop/Shop')
const ShopGoods = ()=> import('../views/Shop/chirdren/ShopGoods')
const ShopRatings = ()=> import('../views/Shop/chirdren/ShopRatings')
const ShopInfo = ()=> import('../views/Shop/chirdren/ShopInfo')
//
// import Login from "../views/Login/Login";
// import Shop from "../views/Shop/Shop";
// import ShopGoods from "../views/Shop/chirdren/ShopGoods";
// import ShopRatings from "../views/Shop/chirdren/ShopRatings";
// import ShopInfo from "../views/Shop/chirdren/ShopInfo";
Vue.use(VueRouter)
const routes = [
  {path: '/', redirect: '/home'},
  {path: '/home', component: Home},  //返回路由组件的函数，只有执行此函数才会加载路由，这个函数在请求对应的路由路径的时候才会执行
  {path: '/order', component: Order},
  {path: '/person', component: Person},
  {path: '/search', component: Search},
  {path:'/login',component:Login,} ,
  {path:'/shop',component:Shop,
    children:[
      {
        path:'/shop/goods',
        component:ShopGoods
      },
      {
        path:'/shop/rating',
        component: ShopRatings
      },
      {
        path:'/shop/info',
        component:ShopInfo
      },
      {
        path:'',
        redirect:'/shop/goods'
      }
    ]
  }
]
const router = new VueRouter({
  routes
})
export default router
